home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr25
/
rxcalc.zip
/
PROGRAM6.CAL
< prev
next >
Wrap
Text File
|
1993-03-01
|
1KB
|
24 lines
/* Rexx Calculator program 4 key - standard deviation of memory */
parse arg num /* get the count of memories */
numeric digits CalcPrecision() /* set current precision */
numeric form value CalcForm() /* set current form */
if \datatype(num, 'Whole') /* must be whole number */
then return 'Error' /* return error indicator */
if num < 1 | num >50 /* valid for counter */
then return 'Error' /* return error indicator */
mean = program3(num) /* get the mean */
accumulator = 0 /* start at zero */
do i = 1 to num /* loop for given number */
'GET' i 'REGISTER' /* get next register */
/* add to total */
accumulator = accumulator + (register - mean)**2
end
/* return standard deviation */
return program2(accumulator / (num - 1))